package com.ruoyi.park.service.impl;

import java.util.List;
import com.ruoyi.common.core.utils.DateUtils;
import cn.hutool.core.util.IdUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.common.core.utils.SecurityUtils;
import com.ruoyi.park.mapper.WyDailySuppliesMapper;
import com.ruoyi.park.domain.WyDailySupplies;
import com.ruoyi.park.service.IWyDailySuppliesService;

/**
 * 日常用品管理Service业务层处理
 *
 * @author cjie
 * @date 2021-07-22
 */
@Service
public class WyDailySuppliesServiceImpl implements IWyDailySuppliesService {
    @Autowired
    private WyDailySuppliesMapper wyDailySuppliesMapper;

    /**
     * 查询日常用品管理
     *
     * @param id 日常用品管理ID
     * @return 日常用品管理
     */
    @Override
    public WyDailySupplies selectWyDailySuppliesById(String id) {
        return wyDailySuppliesMapper.selectWyDailySuppliesById(id);
    }

    /**
     * 查询日常用品管理列表
     *
     * @param wyDailySupplies 日常用品管理
     * @return 日常用品管理
     */
    @Override
    public List<WyDailySupplies> selectWyDailySuppliesList(WyDailySupplies wyDailySupplies) {
        return wyDailySuppliesMapper.selectWyDailySuppliesList(wyDailySupplies);
    }

    /**
     * 新增日常用品管理
     *
     * @param wyDailySupplies 日常用品管理
     * @return 结果
     */
    @Override
    public int insertWyDailySupplies(WyDailySupplies wyDailySupplies) {
        wyDailySupplies.setId(IdUtil.getSnowflake(0, 0).nextIdStr());
        wyDailySupplies.setCreateTime(DateUtils.getNowDate());
        wyDailySupplies.setCreateBy(SecurityUtils.getUsername());
        return wyDailySuppliesMapper.insertWyDailySupplies(wyDailySupplies);
    }

    /**
     * 修改日常用品管理
     *
     * @param wyDailySupplies 日常用品管理
     * @return 结果
     */
    @Override
    public int updateWyDailySupplies(WyDailySupplies wyDailySupplies) {
        wyDailySupplies.setUpdateTime(DateUtils.getNowDate());
        wyDailySupplies.setUpdateBy(SecurityUtils.getUsername());
        return wyDailySuppliesMapper.updateWyDailySupplies(wyDailySupplies);
    }

    /**
     * 批量删除日常用品管理
     *
     * @param ids 需要删除的日常用品管理ID
     * @return 结果
     */
    @Override
    public int deleteWyDailySuppliesByIds(String[] ids) {
        return wyDailySuppliesMapper.deleteWyDailySuppliesByIds(ids);
    }

    /**
     * 删除日常用品管理信息
     *
     * @param id 日常用品管理ID
     * @return 结果
     */
    @Override
    public int deleteWyDailySuppliesById(String id) {
        return wyDailySuppliesMapper.deleteWyDailySuppliesById(id);
    }
}
